﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySpace.Data;

public partial class Ajax_M_Get_WishNote_List : System.Web.UI.Page
{
    private int pagesize=20;
    private int currpage = 0;
    private string filter = "";
    protected void Page_Load(object sender, EventArgs e)
    {
            
        if (!string.IsNullOrEmpty(Request.QueryString["pagesize"]))
            pagesize = Convert.ToInt32(Request.QueryString["pagesize"]);
        if (!string.IsNullOrEmpty(Request.QueryString["currpage"]))
            currpage = Convert.ToInt32(Request.QueryString["currpage"])-1;
        this.bdnode();
    }
    private void bdnode()
    {
        DBHandler dbh = GetHandler.Init();
        if (currpage == 0)
            dbh.CommandText = string.Format("select top {0} * from WishingWall {1} order by id desc", pagesize, filter);
        else
        {
            dbh.CommandText = string.Format("select top {0} * from WishingWall where(id<(select min(id) from (select top {1} id from WishingWall {2} order by id desc))) {3}  order by id desc", pagesize, currpage * pagesize, filter, filter.Replace("where", "and"));

        }
        nodelist_rp.DataSource = dbh.ExecuteDataTable(); ;
        nodelist_rp.DataBind();
    }
}